<!-- Created by henian.xu on 2018/11/15. -->

<template>
    <div class="article">
        <div class="header">
            <div class="label">{{ articleData.title }}</div>
            <div class="desc">{{ articleData.insertTime | moment('YYYY-MM-DD HH:mm:ss') }}</div>
        </div>
        <div
            class="body"
            v-html="articleData.content"/>
    </div>
</template>

<script>
export default {
    data() {
        return {
            articleData: {},
        };
    },
    computed: {
        articleId() {
            return this.$route.params.articleId;
        },
    },
    methods: {
        getArticleData({ id = this.articleId } = {}) {
            return this.$axios
                .get('/rpc/buyer/pt/cms/getCmsArticle', {
                    id,
                })
                .then(json => {
                    const res = json.data;
                    this.articleData = res.data;
                });
        },
    },
    mounted() {
        this.getArticleData();
    },
};
</script>

<style lang="scss">
@import '~/assets/style/_index.scss';
.article {
    padding: 20px;
    > .header {
        text-align: center;
        > .label {
            font-size: 22px;
            font-weight: bold;
        }
        > .desc {
        }
    }
    > .body {
    }
}
</style>
